﻿using UnityEngine;
using System.Collections;

public class RaidBossAI : MonoBehaviour {
	public int maxHealth = 100;
	public int curHealth = 100;
	
	public float healthBarLength;
	
	
	void Start () {
		healthBarLength = Screen.width / 2;
	}
	
	
	void Update () {


		if (curHealth <=0)

		Destroy (gameObject);
	}
	
	
	void OnGUI(){
		//GUI.Box(new Rect(10, 10, healthBarLength, 20), curHealth + "/" + maxHealth);	
	}
	
	
	public void AddjustCurrentHealth(int adj) {
		curHealth += adj;	
		
		if(curHealth < 0)
			curHealth = 0;

		
		if(curHealth > maxHealth)
			curHealth = maxHealth;
		
		if(maxHealth < 1)
			maxHealth = 1;

		//Debug.Log("jotain");
		
		healthBarLength = (Screen.width / 7) * (curHealth / (float)maxHealth);
	}
}